package webScoket

import "time"

type WebScoketOptions struct {
	Pattern         string
	Addr            string
	ReadBufferSize  int
	WriteBufferSize int
	BroadcastSize   int
	MaxMessageSize  int64
	PingPeriod      time.Duration
	WriteWait       time.Duration
	PongWait        time.Duration
}

type WebScoketOption func(*WebScoketOptions)

func WithPattern(pattern string) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.Pattern = pattern
	}
}

func WithAddr(addr string) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.Addr = addr
	}
}

func WithReadBufferSize(readBufferSize int) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.ReadBufferSize = readBufferSize
	}
}

func WithWriteBufferSize(writeBufferSize int) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.WriteBufferSize = writeBufferSize
	}
}

func WithBroadcastSize(size int) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.BroadcastSize = size
	}
}

func WithMaxMessageSize(size int64) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.MaxMessageSize = size
	}
}

func WithPingPeriod(second time.Duration) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.PingPeriod = second
	}
}

func WithWriteWait(second time.Duration) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.WriteWait = second
	}
}

func WithPongWait(second time.Duration) WebScoketOption {
	return func(o *WebScoketOptions) {
		o.PongWait = second
	}
}
